package com.xs.designpattern;

import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;

/**
 * @author xs
 */
@Slf4j
@AllArgsConstructor
public class Hammer implements Weapon {
    private final Enchantment enchantment;

    @Override
    public void wield() {
        log.info("锤子被挥舞着...");
        enchantment.onActivate();
    }

    @Override
    public void swing() {
        log.info("锤子挥动起来...");
        enchantment.apply();
    }

    @Override
    public void unwield() {
        log.info("锤子未挥动...");
        enchantment.onDeactivate();
    }

    @Override
    public Enchantment getEnchantment() {
        return enchantment;
    }
}
